package com.bigdata.movieticketapi.controller;

import com.bigdata.movieticketapi.common.pojo.PageResult;
import com.bigdata.movieticketapi.entity.MovieOrder;
import com.bigdata.movieticketapi.service.IMovieOrderService;
import com.bigdata.movieticketapi.vo.req.DoPayReqVO;
import com.bigdata.movieticketapi.vo.req.GetDataByIdReqVo;
import com.bigdata.movieticketapi.vo.req.PageMovieOrderReqVO;
import com.bigdata.movieticketapi.vo.resp.PageMovieOrderRespVO;
import com.bigdata.movieticketapi.vo.resp.SoldMovieSeatRespVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author movie
 * @since 2023-11-08
 */
@RestController
@RequestMapping("/api")
@Api(tags = "电影订单模块")
@EnableTransactionManagement
public class MovieOrderController {

    @Resource
    private IMovieOrderService iMovieOrderService;

    @PostMapping("/admin/movieOrder/edit")
    @ApiOperation(value = "编辑电影订单")
    public void updateMovieType(@RequestBody @Valid MovieOrder movieOrder){
        iMovieOrderService.updateMovieOrder(movieOrder);
    }

    @PostMapping("/admin/movieOrder")
    @ApiOperation(value = "获取订单分页列表")
    public PageResult<PageMovieOrderRespVO> pageMovieOrders(@RequestBody @Valid PageMovieOrderReqVO vo){
        return iMovieOrderService.pageMovieOrders(vo);
    }

    @PostMapping("/admin/movieOrder/doPay")
    @ApiOperation(value = "支付操作")
    public void doPay(@RequestBody @Valid DoPayReqVO vo){
        iMovieOrderService.doPay(vo);
    }

}
